/**
 * @file phongmaterial.h
 *
 * Surface material in Phong lighting model has 3 different color components:
 * 1) ambient color doesn't depend on the relative position of the light source
 * and surface point
 * 2) diffuse color depends on angle between normal vector to surface and
 * direction of light
 * 3) specular color, like diffuse, depends on angle between normal and direction,
 * but any significant angle attenuates (weakens) the component to almost zero.
 */

#pragma once

#include <util/vec4.h>
#include "../inc.h"

namespace GLC {

class PhongMaterial
{
public:
    PhongMaterial();

    /**
     * @brief SetDiffuse - sets a diffuse component of material
     * @param r - red color component
     * @param g - green color component
     * @param b - blue color compoment
     * @param a - alpha-channel component
     */
    void SetDiffuse(float r, float g, float b, float a = 1);

    /**
     * @brief SetAmbient - sets an ambient component of material
     * @param r - red color component
     * @param g - green color component
     * @param b - blue color compoment
     * @param a - alpha-channel component
     */
    void SetAmbient(float r, float g, float b, float a = 1);

    /**
     * @brief SetSpecular - sets a specular component of material
     * @param r - red color component
     * @param g - green color component
     * @param b - blue color compoment
     * @param a - alpha-channel component
     */
    void SetSpecular(float r, float g, float b, float a = 1);

    // Степень зеркального отражения (для модели Фонга)
    void SetShininess(float shininess);

    /**
     * @brief Activate - activates material for given faces group (front or back)
     * @param side asseptable values are GL_FRONT, GL_BACK, GL_FRONT_AND_BACK
     */
    void Activate(GLenum side = GL_FRONT)const;
private:
    float m_shininess;
    vec4f m_diffuse;
    vec4f m_specular;
    vec4f m_ambient;
};


} // namespace GLC
